import { Router } from "express";
import { AuthController } from "../controllers";
import { deserializeUser, requireLogin, validate } from "../middlewares";
import { registerSchema, loginSchema } from "../schemas";

const router = Router();

router.post("/register", validate(registerSchema), AuthController.register);
router.post("/login", validate(loginSchema), AuthController.login);
router.get("/logout", deserializeUser, requireLogin, AuthController.logout);

export { router as authRouter };
